﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Reflection;

using System.Web.Routing;
using System.Web.Security;
using ZXCompany.Models;
using ZXCompany.Models.Entity;
using System.Text;
using System.Collections.Generic;

namespace ZXCompany.Controllers
{
    public class ActiveController : Controller
    {
        private static readonly log4net.ILog logger = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
        public Models.Service.ServiceFactory SerFac = new Models.Service.ServiceFactory();
        //
        // GET: /Active/
        /// <summary>
        /// 动态前沿（公司新闻）
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            try
            {
                //ViewData["Message"] = "欢迎使用 ASP.NET MVC!";mainmenu_a/activemenu
                //网站首页
                ViewData["IndexTitleClass"] = "mainmenu_a";
                //关于我们
                ViewData["AboutTitleClass"] = "mainmenu_a";
                //业务领域
                ViewData["BusinessTitleClass"] = "mainmenu_a";
                //解决方案
                ViewData["SolutionTitleClass"] = "mainmenu_a";
                //动态前沿
                ViewData["ActiveTitleClass"] = "activemenu";
                //联系我们
                ViewData["ContUsTitleClass"] = "mainmenu_a";
                IList<ZX_News> Homelist = SerFac.GetAboutService().GetNews();
                ViewData["Active_News"] = Homelist;
                return View();
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                return View("Error");
            }
        }
        /// <summary>
        /// 动态前沿（弗睿森观点）
        /// </summary>
        /// <returns></returns>
        public ActionResult FreasingView()
        {
            try
            {
                //ViewData["Message"] = "欢迎使用 ASP.NET MVC!";mainmenu_a/activemenu
                //网站首页
                ViewData["IndexTitleClass"] = "mainmenu_a";
                //关于我们
                ViewData["AboutTitleClass"] = "mainmenu_a";
                //业务领域
                ViewData["BusinessTitleClass"] = "mainmenu_a";
                //解决方案
                ViewData["SolutionTitleClass"] = "mainmenu_a";
                //动态前沿
                ViewData["ActiveTitleClass"] = "activemenu";
                //联系我们
                ViewData["ContUsTitleClass"] = "mainmenu_a";
                List<ZX_CompanyPoint> Homelist = SerFac.GetAboutService().GetCompanyPoint();
                ViewData["Account_ExpertType"] = Homelist;
                return View();
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                return View("Error");
            }
        }
        /// <summary>
        /// 动态前沿（新闻详细）
        /// </summary>
        /// <returns></returns>
        public ActionResult NewsDetail()
        {
            try
            {
                //ViewData["Message"] = "欢迎使用 ASP.NET MVC!";mainmenu_a/activemenu
                //网站首页
                ViewData["IndexTitleClass"] = "mainmenu_a";
                //关于我们
                ViewData["AboutTitleClass"] = "mainmenu_a";
                //业务领域
                ViewData["BusinessTitleClass"] = "mainmenu_a";
                //解决方案
                ViewData["SolutionTitleClass"] = "mainmenu_a";
                //动态前沿
                ViewData["ActiveTitleClass"] = "activemenu";
                //联系我们
                ViewData["ContUsTitleClass"] = "mainmenu_a";
                int tid = Convert.ToInt32(Request.QueryString["nid"]);
                List<ZX_News> newslist = SerFac.GetAboutService().GetNewsById(tid);
                ViewData["Newslist"] = newslist;
                return View();
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                return View("Error");
            }
        }
        /// <summary>
        /// 动态前沿（观点详细）
        /// </summary>
        /// <returns></returns>
        public ActionResult ViewDetail()
        {
            try
            {
                //ViewData["Message"] = "欢迎使用 ASP.NET MVC!";mainmenu_a/activemenu
                //网站首页
                ViewData["IndexTitleClass"] = "mainmenu_a";
                //关于我们
                ViewData["AboutTitleClass"] = "mainmenu_a";
                //业务领域
                ViewData["BusinessTitleClass"] = "mainmenu_a";
                //解决方案
                ViewData["SolutionTitleClass"] = "mainmenu_a";
                //动态前沿
                ViewData["ActiveTitleClass"] = "activemenu";
                //联系我们
                ViewData["ContUsTitleClass"] = "mainmenu_a";
                int tid = Convert.ToInt32(Request.QueryString["vid"]);
                List<ZX_CompanyPoint> comp = SerFac.GetAboutService().GetCompanyPointById(tid);
                ViewData["CompanyPoint"] = comp;
                return View();
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                return View("Error");
            }
        }
    }
}
